import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from project_utils.mysql_conncet import ReadFromMysql
from config import *

mysql = ReadFromMysql(host=mysqlhost, user=user, password=password, port=3306)
mysql.makepool(database)


def get_material(tablename):
    conn = mysql.getconn()
    sc = conn.cursor()
    sc.execute(f""" SELECT distinct name,model FROM {tablename}
                where type='WASHER' """)
    conn.commit()
    result = sc.fetchall()
    material = [i[0] for i in result]
    model = [i[1] for i in result]
    return material, model